package textExcel;

public class TestTextExcel
{
	public static void main(String[] args)
	{
		// some stupid modification
		
		Spreadsheet ss = new Spreadsheet();
		
		System.out.println(ss.isValidCell('C', 1));
		System.out.println(ss.isValidCell("C1"));
		
		ss.setCell('A', 1, new StringCell("hamster"));
		ss.setCell('A', 2, new StringCell("cat"));
		
		ss.setCell('B', 1, new StringCell("something longer than 10 characters"));
		ss.setCell('B', 2, new StringCell("10 chrctrs"));
		
		ss.setCell('C', 1, new RealCell(5.0, ss));
		ss.setCell('C', 2, new RealCell("( 7 )", ss));
		ss.setCell('C', 3, new RealCell(7.19021401291231211232131232, ss));
		ss.setCell('C', 4, new RealCell("( C1 + C2 + 4 )", ss));
		
		ss.setCell('D', 1, new MethodCell("( SUM C1-C4 )", ss));
		ss.setCell('D', 2, new MethodCell("( AVG C1-C4 )", ss));
		
		ss.setCell('E', 1, new MethodCell("( SUM C1-D2 )", ss));
		
		System.out.println(ss);
		
		System.out.println(ss.getCellValue('A', 1, true));
		System.out.println(ss.getCellValue('B', 1, true));
		
		System.out.println(ss.getCellValue('C', 1, true));
		System.out.println(ss.getCellValue('C', 2, true));
		System.out.println(ss.getCellValue('C', 3, true));
		System.out.println(ss.getCellValue('C', 4, true));
		
		Cell[][] cellsInRange = ss.getCellRange("A1", "B2");
		
		for(int row = 0; row < cellsInRange.length; row++)
		{
			for(int column = 0; column < cellsInRange[0].length; column++)
			{
				System.out.print(cellsInRange[row][column] + " ");
			}
			System.out.println();
		}
	}
}
